//
//  UIColor+Additions.m
//
//  Created by Esther on 2016/12/10.
//  Copyright © 2016年 Esther. All rights reserved.
//


#import "UIColor+Additions.h"

@implementation UIColor (Additions)

#pragma mark -
#pragma mark - 随机色
+ (instancetype)ss_randomColor{
    
    CGFloat r = arc4random_uniform(256) / 255.0;
    CGFloat b = arc4random_uniform(256) / 255.0;
    CGFloat g = arc4random_uniform(256) / 255.0;
    return [UIColor colorWithRed:r green:g blue:b alpha:1];
}

#pragma mark -
#pragma mark - 使用 R G  B 数值创建颜色
+ (instancetype)ss_colorWithRed:(uint8_t)red green:(uint8_t)green blue:(uint8_t)blue {
    return [UIColor colorWithRed:red / 255.0 green:green / 255.0 blue:blue / 255.0 alpha:1.0];
}

#pragma mark -
#pragma mark -  使用 16 进制数字创建颜色，例 0x000000
+ (instancetype)ss_colorWithHex:(uint32_t)hex {
    
    uint8_t r = (hex & 0xff0000) >> 16;
    uint8_t g = (hex & 0x00ff00) >> 8;
    uint8_t b = hex & 0x0000ff;
    
    return [self ss_colorWithRed:r green:g blue:b];
}



@end
